#namespace("com.htwy.core.model.Attachment")
  #sql("findByCondition")
    SELECT uuid, filename, filePath, suffix, mineType, fileSize, uploadTime, uploader, deleteTime, deleteBy, entityName, fieldName, pkValue, status
    FROM ht_sys_attachment
    #WHERE()
      #if(uuid)
        uuid = #para(uuid)
      #end
      #if(filename)
        AND filename = #para(filename)
      #end
      #if(filePath)
        AND filePath = #para(filePath)
      #end
      #if(suffix)
        AND suffix = #para(suffix)
      #end
      #if(mineType)
        AND mineType = #para(mineType)
      #end
      #if(fileSize)
        AND fileSize = #para(fileSize)
      #end
      #if(uploadTime)
        AND uploadTime = #para(uploadTime)
      #end
      #if(uploader)
        AND uploader = #para(uploader)
      #end
      #if(deleteTime)
        AND deleteTime = #para(deleteTime)
      #end
      #if(deleteBy)
        AND deleteBy = #para(deleteBy)
      #end
      #if(entityName)
        AND entityName = #para(entityName)
      #end
      #if(fieldName)
        AND fieldName = #para(fieldName)
      #end
      #if(pkValue)
        AND pkValue = #para(pkValue)
      #end
      #if(status)
        AND status = #para(status)
      #end
    #end
    ORDER BY uploadTime desc
    
  #end

  #sql("deleteByPks")
    DELETE FROM ht_sys_attachment
    #WHERE()
      #if(pks != null && pks.length > 0)
        #if(pks.length>1)
          uuid in (
          #for(tempId : pks)
            #if(for.first)
              #para(tempId)
            #else
              , #para(tempId)
            #end
          #end
          )
        #else
          uuid = #para(pks[0])
        #end
      #end
    #end
  #end
#end